package com.pub.functions;

import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Check {
	public static final String wgcode="^[A-Za-z0-9_]{2,18}";
	public static final String hex="^[A-Za-z0-9_]{2,38}";
	public static final String username = "^[A-Za-z0-9_]{2,18}";
	public static final String password = "^[A-Za-z0-9_]{6,18}";
	public static final String unSafe="^(([A-Z]*|[a-z]*|\\d*|[-_\\~!@#\\$%\\^&\\*\\.\\(\\)\\[\\]\\{\\}<>\\?\\\\\\/\'\"]*)|.{0,5})$|\\s";
	public static final String number = "^-?[0-9_]{1,18}";
	public static final String date="^((((1[6-9]|[2-9]\\d)\\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\\d|3[01]))|(((1[6-9]|[2-9]\\d)\\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\\d|30))|(((1[6-9]|[2-9]\\d)\\d{2})-0?2-(0?[1-9]|1\\d|2[0-8]))|(((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))";
	public static final String dateTime="^(\\d{4})-(0\\d{1}|1[0-2])-(0\\d{1}|[12]\\d{1}|3[01]) (0\\d{1}|1\\d{1}|2[0-3]):[0-5]\\d{1}:([0-5]\\d{1})";
	public static final String number1="^[0-9_]{1,2}";
    public static final String zhongyingwen="^[\\s0-9A-Za-z\u0391-\uFFE5]+";
    public static final String productCode="^[0-9A-Za-z_]+";
    public static final String orderbuyflag="^[1-2]{1}";
    public static final String email="^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
	public static final String myfloat="^(([0-9]{0,30}(.[0-9]{1,4}))|(([0-9]{1,30})(.[0-9]{1,4})?))";
	public static final String mobile="^((13)|(18)|(15))\\d{9}";
	public static final String muser = "^[0-9_,]{1,5999}";
	   
    public static boolean check(String str, String type) {
        if(str==null){
        	return false;
        }
		Pattern p1 = Pattern
				.compile(type);
		Matcher m1 = p1.matcher(str);
		if (m1.matches()) {

			return true;
		} else {
			return false;
		}

	}
	public static void main(String[] arg){
		//String str="abforcd d  or ***";
		//System.out.println(Check.check(str, Check.username));
		//System.out.print(Check.check(str, Check.unSafe));
		//String str="\\namager\\sysUserAction.do?method=editview&userid=119070870571411";
	   // String str="aa";
		
	   // str=str.replace('\\', '/');
	   // System.out.print(str);
	   
	    //String a[]=str.split("/");
	  //  for(int i=0;i<a.length;i++){
	    	//System.out.println(a[i]);
	   // }
		System.out.println(Check.check("", Check.myfloat));
	}
	

}
